import request from '@/utils/request';

/**
 * 好友列表
 * @returns 
 */
export function listFriends() {
  return request({
    url: '/user_friends/list',
    method: 'get',
  });
}

interface AddFrienObj {
  friendId: string | number;
  message?: string;
}

/**
 * 添加好友
 * @param friendId 好友id
 * @returns 
 */
export function addFriend(data : AddFrienObj) {
  console.log(data);
  
  return request({
    url: '/user_friends',
    params: data,
    method: 'post'
  })
}

/**
 * 删除好友
 * @param friendId 好友id
 * @returns 
 */
export function removeFriend(friendId: string | number) {
  return request({
    url: '/user_friends/' + friendId,
    method: 'delete'
  })
}

/**
 * 查询好友
 * @param keyword 
 * @returns 
 */
export function findFriends(keyword: string) {
  return request({
    url: '/user_friends/' + keyword,
    method: 'get'
  })
}


